var swiper = new Swiper(".swiper-container",{
	autoplay: 3000,//可选选项，自动滑动
	loop:true
})
FormatImg($(".shop-logo-format"),$(".shop-logo-format").parents(".img-container"));
$(function(){
	var cart_text = $(".cart-item").find(".item_buy").text()
	$(".more").on("tap",".goToBuy",function(){
		$(".cart-item").before($("<div class='shadow'></div>"))
		var footerH  = $(".myfooter").height();
		$(".cart-item").css("bottom",footerH)
		//判断是否为单独购买
		if($(this).hasClass("only")){
			$(".cart-item").find(".item_buy").text("立即购买");
		}else{
			$(".cart-item").find(".item_buy").text(cart_text);
		}
	})
	$(".cart-item").on("tap",".close",function(){
		$(".cart-item").css("bottom","-100%")
		$(".shadow").remove()
	})
	//定时器
	$(".shopGroup-member").each(function(){
		var id = $(this)[0].id;
		new timer().showTime({
			container_id:'#'+id,
			start:parseInt($("#"+id).find(".time-container").attr("data-start")),
			now:parseInt($("#"+id).find(".time-container").attr("data-now")),
			end:parseInt($("#"+id).find(".time-container").attr("data-end")),
		}).countDown();	
	})
})
goToTop($(".goToTop"));

//点击加入购物车
$(".item_add").on("tap",function(){
	var _this = $(this)
	var num = _this.parents(".cart-item").find(".num_txt").val()
	var fcn = $(".footer_cart_num")
	if(fcn.css("display")=="none"){
		fcn.show();
		fcn.text(num);
	}else{
		fcn.text(parseInt(fcn.text())+parseInt(num));
	}
	  fcn.animate({	
	  	
	  	
	  	transform:"scale(1.2)"
	  	},"fast","swing",function(){
	  		fcn.animate({transform:"scale(1)"})
	  	});
})
//商品处理
FormatImg($(".format"),$(".format").parents(".swiper-container"));